<?php

/**
 * PlayerGame filter form.
 *
 * @package    bgMicroLeague
 * @subpackage filter
 * @author     Your name here
 */
class GameResultForm extends sfForm
{
  public function configure()
  {
    $years = GameQuery::create()->getYearListArray();
    $trimesters = array(
        "1" => 'I Trim.',
        "2" => 'II Trim.',
        "3" => 'III Trim.',
        "4" => 'IV Trim.',
    );
    
    $methodCriteriaForLeagueList = (is_null($this->getOption('user', null))) ? null : 'getByUserCriteria';

    $this->setWidgets(array(
      'id_league' => new sfWidgetFormPropelChoice(array('model' => 'League', 'add_empty' => false, 'criteria' => $methodCriteriaForLeagueList)),
      'year' => new sfWidgetFormChoice(array('choices' => $years)),
      'trimester' => new sfWidgetFormChoice(array('choices' => $trimesters, 'multiple' => true, 'expanded' => true)),
      
    ));

    $this->setValidators(array(
      'id_league' => new sfValidatorPropelChoice(array('required' => true, 'model' => 'League', 'column' => 'id')),
      'year' => new sfValidatorChoice(array('choices' => array_keys($years), 'required' => true)),
      'trimester' => new sfValidatorChoice(array('choices' => array_keys($trimesters), 'required' => true, 'multiple' => true)),
    ));

    $this->widgetSchema->setNameFormat('game_filters[%s]');
  }
  
  


}
